package C11_7_ExtractSuperclass.refactorbefore;

import java.util.Enumeration;
import java.util.Vector;

/**
 * @ClassName : Department
 * @Description :
 * @Author : wukj1
 * @Date: 2022/8/15
 **/
public class Department {

    private String name;
    private Vector staff = new Vector();

    public Department(String name) {
        this.name = name;
    }

    public int getTotalAnnualCost() {
        Enumeration e = getStaff();
        int result = 0;
        while(e.hasMoreElements()){
            Employee each = (Employee) e.nextElement();
            result += each.getAnnualCost();
        }
        return result;
    }

    public int getHeadCount() {
        return staff.size();
    }

    public Enumeration getStaff() {
        return staff.elements();
    }

    public void addStaff(Employee org){
        staff.add(org);
    }

    public String getName() {
        return name;
    }
}
